<%--
  User: Shengzhao Li
  Date: 13-8-6
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="custom" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="displaytag" uri="http://displaytag.sf.net" %>
<html>
<head>
    <title>Sprint</title>
</head>
<body>
<div class="row">
    <hr/>
    <div class="span8">
        <form action="" id="sprintForm" class="form-inline">
            <select name="status" id="sprintStatusSelect">
                <option value="">All status</option>
                <c:forEach items="${sprintOverviewDto.availableStatuses}" var="s">
                    <option value="${s}" ${s eq sprintOverviewDto.status?'selected':''}>${s.label}</option>
                </c:forEach>
            </select>
            <%--<button class="btn btn-small" type="submit"><i class="icon-search"></i> Search</button>--%>
        </form>
    </div>
    <div class="span2">
        &nbsp;
    </div>
    <div class="span2">
        <a class="btn btn-success btn-small" href="sprint_form/create"><i
                class="icon-plus icon-white"></i> Create sprint</a>
    </div>

</div>
<div class="row">
    <div class="span12">
        <div class="alert alert-success hide">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <div><i class="icon-ok-sign icon-white"></i>
                <span id="sprintFormSuccess" class="hide">Add/Edit the sprint successful!</span>
                <span id="archiveSprintSuccess" class="hide">Archive the sprint successful!</span>
            </div>
        </div>
        <div class="alert alert-info hide">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <div><i class="icon-info-sign icon-white"></i>
                <span id="finishSprintInfo" class="hide">The sprint has been finished.!</span>
            </div>
        </div>
        <div class="alert alert-error hide">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <div><i class="icon-warning-sign icon-white"></i>
                <%--<span id="alertErrorInfo"></span>--%>
            </div>
        </div>
    </div>
</div>
<div class="row">
    <div class="span9">
        <displaytag:table list="${sprintOverviewDto}" class="table table-hover" id="sprint"
                          form="sprintForm">
            <displaytag:column title="Name" headerClass="width25" class="${sprint.status}">
                <div class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            ${sprint.name}
                        <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
                        <custom:sprint_overview_menu_actions currentSprint="${sprint}"/>
                    </ul>
                </div>
            </displaytag:column>
            <displaytag:column title="Progress" headerClass="width25">
                <c:set var="progressVal"
                       value="${empty sprint.usedTimeAsPercent?'0%':sprint.usedTimeAsPercent}"/>
                <div class="progress progress-striped" title="${progressVal} finished" style="margin-bottom: 5px;">
                    <div class="bar" style="width: ${progressVal};"></div>
                </div>
            </displaytag:column>
            <displaytag:column title="Estimate / Used">
                ${sprint.estimateTimesAsHour} / ${sprint.usedTimesAsHour}${sprint.timeDifferenceAsHtml}
            </displaytag:column>
            <displaytag:column title="Start / Deadline">
                ${sprint.startDate} / ${sprint.deadline}
            </displaytag:column>
            <displaytag:column title="&nbsp;">
                <a href="javascript:void(0)" data-content="${sprint.htmlTip}" class="sprintDetails"
                        ><i class="icon-info-sign"></i></a>
                <c:if test="${sprint.haveBacklogs}">
                    <a href="javascript:void(0)" title="Show backlogs"
                       load-url="${contextPath}/developer/sprint_action/load_backlogs/${sprint.guid}"
                       class="sprintBacklogDetails"><i class="icon-tags"></i></a>
                </c:if>
            </displaytag:column>
        </displaytag:table>
    </div>
    <div class="span3">
        <div class="well">
            <div>
                <h5><a href="javascript:void(0);">Legend</a></h5>
            </div>

            <div>
                <table class="table">
                    <tr class="info">
                        <td>Pending</td>
                    </tr>
                    <tr class="success">
                        <td>Finished</td>
                    </tr>
                    <tr style="background-color: white;">
                        <td>Created</td>
                    </tr>
                </table>
            </div>

        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        new SprintOverview("${param.alert}");
    });
</script>
</body>
</html>